ActualizacionDatos = function(){
	return {
		saveKycProcesarPerfil: function(){
			Asi.message.progress(Asi.constants.SAVING);
			Ext.getCmp("asiActualizacionDatosForm").getForm().submit({
				url: Asi.constants.CONTEXT_PATH + "/cliente/actualizarDatosSave",
    			timeout: Asi.constants.TIMEOUT_SECONDS,
    			params: {
    				"usuarioId": AsiGen.getUsuarioId(),
    				"tipoCliente": Ext.getCmp("tipoCliente").getValue(),
    				"numeroCuenta": Ext.getCmp("numeroCuenta").getValue(),
    				"departamentoId": Ext.getCmp("departamentoId").getValue(),
    				"ctgmunicipioId": Ext.getCmp("ctgmunicipioId").getValue()
    			},
    			success: function(form, action){
    				Asi.message.alert(action.result.message);
    			},
    			failure: Asi.form.failureProcedure
			});
		},
		init: function(config){
			var sgiPersona = config;
			var configToReturn = {};
			configToReturn.items = [];
			configToReturn.menu = AsiBotones.getBotones(AsiGen.getTipoUsuario(), AsiGen.getPantallaId());
			configToReturn.items.push({
				xtype: "form",
				flex: 1,
				id: "asiActualizacionDatosForm",
				title: "ACTUALIZAR DATOS PERSONALES",
				autoScroll: true,
				listeners: {
					render: function(){
						if(sgiPersona){
							if(this.getForm()){
								this.getForm().setValues(sgiPersona);
							}
						}
					}
				},
				dockedItems:[
		             {
		            	 xtype: "toolbar",
		            	 dock: "top",
		            	 items: [
							"->",
							{
								 text: "Guardar",
								 iconCls: Asi.constants.icons.SAVE_ICON,
								 handler: ActualizacionDatos.saveKycProcesarPerfil
							}
            	         ]
		             },{
		            	 xtype: "toolbar",
		            	 dock: "bottom",
		            	 items: [
							"->",
							{
								 text: "Guardar",
								 iconCls: Asi.constants.icons.SAVE_ICON,
								 handler: ActualizacionDatos.saveKycProcesarPerfil
							}
            	         ]
		             }
	            ],
				layout: {
					type: "table",
					columns: 6,
					tableAttrs: {
			            style: {width: "730px", "margin-top": "5px", "margin-bottom": "40px"},
			            align: "center"
			        }
				},
				defaults: Asi.utils.defaults({width: 230, colspan: 2}),
				items: [
			        {
						xtype: "label",
						text: "ACTUALIZAR DATOS PERSONALES",
						cls: "x-form-item label_header",
						colspan: 6,
						width: 730
					},
					{xtype: "label", text:"1er Nombre", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"2do Nombre", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"1er Apellido", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {
				     xtype: "textfield",
				     readOnly: true,
				     id: "PersonaPrimerNombre",
				     name: "sgiPersona.PersonaPrimerNombre",
				     colspan:2
				    },
				    {
				     xtype: "textfield",
				     readOnly: true,
				     id: "PersonaSegundoNombre",
				     name: "sgiPersona.PersonaSegundoNombre",
				     colspan:2
				    },
				    {
				     xtype: "textfield",
				     readOnly: true,
				     id: "PersonaPrimerApellido",
				     name: "sgiPersona.PersonaPrimerApellido",
				     colspan:2
				    },
				    
				    {xtype: "label", text:"2do Apellido", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"Email", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"Direccion", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {
				     xtype: "textfield",
				     readOnly: true,
				     id: "PersonaSegundoApellido",
				     name: "sgiPersona.PersonaSegundoApellido",
				     colspan:2
				    },
				    {
				     xtype: "textfield",
				     id: "personaEmail",
				     name: "sgiPersona.personaEmail",
				     colspan:2,
				     vtype: 'email'
				    },
				    {
					     xtype: "textfield",
					     id: "personaDireccion",
					     name: "sgiPersona.personaDireccion",
					     colspan:2
					},
					    
					    
				    {
						xtype: "label",
						text: "ACTUALIZAR DATOS DE ENTIDAD",
						cls: "x-form-item label_header",
						colspan: 6,
						width: 730
					},
					
					{xtype: "label", text:"Tipo Persona", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"No Registro", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {
						xtype: "combo",
						id: "tipoCliente",
						colspan:2,
						store: new Ext.data.SimpleStore({
							data: config.ctgTipoPersona || [],
							fields: [
							         "ctgCatalogoId",
							         "ctgCatalogoNombre",
							         "ctgCatalogoPadre",
							         "ctgCatalogoHijo"
							        ]
						}),
						displayField: "ctgCatalogoNombre",
						valueField: "ctgCatalogoId",
						allowBlank: false,
						value: config.ctgTipoPersona
					},
				    {
				     xtype: "textfield",
				     id: "numeroCuenta",
				     colspan:2
				    },
				    {
					     xtype: "hidden",
					     id: "pnm",
					     colspan:2
					},
					
					
					{xtype: "label", text:"DUI", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"Registro Fiscal", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {
				     xtype: "textfield",
				     id: "personaDocumento1",
				     name: "sgiPersona.personaDocumento1",
				     colspan:2,
				     vtype: 'dui'
				    },
				    {
				     xtype: "textfield",
				     id: "personaDocumento2",
				     name: "sgiPersona.personaDocumento2",
				     colspan:2,
				     vtype: 'nit'
				    },
				    {
					     xtype: "hidden",
					     id: "654a",
					     colspan:2
					},
					
					
					
					{xtype: "label", text: "Departamento", cls: "lblHeaderLecter1"},
					{xtype: "label", text: "Municipio", cls: "lblHeaderLecter1"},
					{xtype: "label", text:"", cls: "lblHeaderLecter1", width : 230, colspan : 2},
					{
						xtype : "combo",
						id : "departamentoId",
						store : new Ext.data.SimpleStore({
							data : Asi.combos.getAllDepartamento() || [],
							fields : [ "id","nombre" ]
						}),
						displayField : "nombre",
						valueField : "id",
						allowBlank : false
						,
						listeners : {
							change : function() {
								Asi.combos.loadData("ctgmunicipioId",
								Asi.combos.getAllMunicipiosByDepartamentoCombo(this.getValue(),Asi.combos.getAllMunicipio()));
							},
							render : function() {
								Asi.combos.loadData("ctgmunicipioId",
								Asi.combos.getAllMunicipiosByDepartamentoCombo(this.getValue(),Asi.combos.getAllMunicipio()));
							}},
						value: config.ctgDepartamento
					},
					{
						xtype : "combo",
						id : "ctgmunicipioId",
						store : new Ext.data.SimpleStore({
							data : [],
							fields : [ "catalogoMunicipioId", "catalogoMunicipioNombre","catalogoMunicipioZonaRiesgo", "catalogoDepartamentoId" ]}),
						displayField : "catalogoMunicipioNombre",
						valueField : "catalogoMunicipioId",
						allowBlank : false,
						value: config.ctgmunicipioId
					},
					{
					     xtype: "hidden",
					     id: "vacio",
					     colspan:2
					},
					
					{xtype: "label", text:"Tel\u00e9fono Casa", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"Celular", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {xtype: "label", text:"Tel\u00e9fono Oficina", cls: "lblHeaderLecter1", width : 230, colspan : 2},
				    {
				     xtype: "textfield",
				     id: "personaTelefono1",
				     name: "sgiPersona.personaTelefono1",
				     colspan:2,
				     vtype: 'telefonoDomicilio'
				    },
				    {
				     xtype: "textfield",
				     id: "personaTelefono2",
				     name: "sgiPersona.personaTelefono2",
				     colspan:2,
				     vtype: 'telefonoCelular'
				    },
				    {
					     xtype: "textfield",
					     id: "personaTelefono3",
					     name: "sgiPersona.personaTelefono3",
					     colspan:2,
					     vtype: 'telefonoDomicilio'
					},
					
				    
			        {
				     xtype: "hidden",
				     id: "sgiPersonaId",
				     name: "sgiPersona.sgiPersonaId"
			        }
			        
					
			        
		        ]
            });
	        return configToReturn;
		}
	};
}();
